<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core">

    <h:body>

        <ui:composition template="../communityTemplate.xhtml">
            <ui:define name="content">
                <h:form>

                    <p:inputText value="#{searchUserBean.search}">
                        <f:ajax event="keyup" render="resultTable"/>
                    </p:inputText>

                    <p:dataTable id="resultTable" value="#{searchUserBean.data}" var="data" paginator="true" rows="10"  
                 paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"  
                 rowsPerPageTemplate="20,50,100">

                        <p:column id="name">
                            <f:facet name="header">
                                <h:outputText value="Name"/>
                            </f:facet>
                            <h:outputText value="#{data.name}"/>
                        </p:column>

                        <p:column id="email">
                            <f:facet name="header">
                                <h:outputText value="Email"/>
                            </f:facet>
                            <h:outputText value="#{data.email}"/>
                        </p:column>

                        <p:column id="action"> 
                            <h:commandButton value="View" action="#{searchUserBean.goToDetails}" actionListener="#{searchUserBean.selectionListener}">
                                <f:attribute name="selection" value="#{data}"/>
                            </h:commandButton>
                            <h:commandButton value="friend request" actionListener="#{searchUserBean.friendListener}">
                                <f:attribute name="selection" value="#{data}"/>
                            </h:commandButton>
                       </p:column> 
                        
                    </p:dataTable>   
                    
                </h:form>
            </ui:define>
        </ui:composition>

    </h:body>
</html>

